Integrand size = 28, antiderivative size = 93 \[ \int \frac {(a+i a \tan (e+f x))^2}{(c+d \tan (e+f x))^2} \, dx=\frac {2 a^2 x}{(c-i d)^2}-\frac {2 i a^2 \log (c \cos (e+f x)+d \sin (e+f x))}{(c-i d)^2 f}+\frac {a^2 (i c-d)}{d (i c+d) f (c+d \tan (e+f x))} \]
2*a^2*x/(c-I*d)^2-2*I*a^2*ln(c*cos(f*x+e)+d*sin(f*x+e))/(c-I*d)^2/f+a^2*(I *c-d)/d/(I*c+d)/f/(c+d*tan(f*x+e))
Time = 1.27 (sec) , antiderivative size = 169, normalized size of antiderivative = 1.82 \[ \int \frac {(a+i a \tan (e+f x))^2}{(c+d \tan (e+f x))^2} \, dx=-\frac {a^2 \left (c d-i d^2+2 c (-i c+d) \log (i+\tan (e+f x))+2 i c^2 \log (c+d \tan (e+f x))-2 c d \log (c+d \tan (e+f x))+\left (c^2+i c d+2 d^2+2 d (-i c+d) \log (i+\tan (e+f x))+2 i (c+i d) d \log (c+d \tan (e+f x))\right ) \tan (e+f x)\right )}{(c-i d)^2 (c+i d) f (c+d \tan (e+f x))} \]
-((a^2*(c*d - I*d^2 + 2*c*((-I)*c + d)*Log[I + Tan[e + f*x]] + (2*I)*c^2*L og[c + d*Tan[e + f*x]] - 2*c*d*Log[c + d*Tan[e + f*x]] + (c^2 + I*c*d + 2* d^2 + 2*d*((-I)*c + d)*Log[I + Tan[e + f*x]] + (2*I)*(c + I*d)*d*Log[c + d *Tan[e + f*x]])*Tan[e + f*x]))/((c - I*d)^2*(c + I*d)*f*(c + d*Tan[e + f*x ])))
Time = 0.58 (sec) , antiderivative size = 118, normalized size of antiderivative = 1.27, number of steps used = 7, number of rules used = 7, \(\frac {\text {number of rules}}{\text {integrand size}}\) = 0.250, Rules used = {3042, 4025, 27, 3042, 4014, 3042, 4013}
Below are the steps used by Rubi to obtain the solution. The rule number used for the transformation is given above next to the arrow. The rules definitions used are listed below.
\(\displaystyle \int \frac {(a+i a \tan (e+f x))^2}{(c+d \tan (e+f x))^2} \, dx\) |
\(\Big \downarrow \) 3042 |
\(\displaystyle \int \frac {(a+i a \tan (e+f x))^2}{(c+d \tan (e+f x))^2}dx\) |
\(\Big \downarrow \) 4025 |
\(\displaystyle \frac {\int \frac {2 \left ((c+i d) a^2+(i c-d) \tan (e+f x) a^2\right )}{c+d \tan (e+f x)}dx}{c^2+d^2}+\frac {a^2 (-d+i c)}{d f (d+i c) (c+d \tan (e+f x))}\) |
\(\Big \downarrow \) 27 |
\(\displaystyle \frac {2 \int \frac {(c+i d) a^2+(i c-d) \tan (e+f x) a^2}{c+d \tan (e+f x)}dx}{c^2+d^2}+\frac {a^2 (-d+i c)}{d f (d+i c) (c+d \tan (e+f x))}\) |
\(\Big \downarrow \) 3042 |
\(\displaystyle \frac {2 \int \frac {(c+i d) a^2+(i c-d) \tan (e+f x) a^2}{c+d \tan (e+f x)}dx}{c^2+d^2}+\frac {a^2 (-d+i c)}{d f (d+i c) (c+d \tan (e+f x))}\) |
\(\Big \downarrow \) 4014 |
\(\displaystyle \frac {2 \left (\frac {a^2 x (c+i d)}{c-i d}-\frac {a^2 (-d+i c) \int \frac {d-c \tan (e+f x)}{c+d \tan (e+f x)}dx}{c-i d}\right )}{c^2+d^2}+\frac {a^2 (-d+i c)}{d f (d+i c) (c+d \tan (e+f x))}\) |
\(\Big \downarrow \) 3042 |
\(\displaystyle \frac {2 \left (\frac {a^2 x (c+i d)}{c-i d}-\frac {a^2 (-d+i c) \int \frac {d-c \tan (e+f x)}{c+d \tan (e+f x)}dx}{c-i d}\right )}{c^2+d^2}+\frac {a^2 (-d+i c)}{d f (d+i c) (c+d \tan (e+f x))}\) |
\(\Big \downarrow \) 4013 |
\(\displaystyle \frac {2 \left (\frac {a^2 x (c+i d)}{c-i d}-\frac {a^2 (-d+i c) \log (c \cos (e+f x)+d \sin (e+f x))}{f (c-i d)}\right )}{c^2+d^2}+\frac {a^2 (-d+i c)}{d f (d+i c) (c+d \tan (e+f x))}\) |
(2*((a^2*(c + I*d)*x)/(c - I*d) - (a^2*(I*c - d)*Log[c*Cos[e + f*x] + d*Si n[e + f*x]])/((c - I*d)*f)))/(c^2 + d^2) + (a^2*(I*c - d))/(d*(I*c + d)*f* (c + d*Tan[e + f*x]))
3.11.90.3.1 Defintions of rubi rules used
Int[(a_)*(Fx_), x_Symbol] :> Simp[a Int[Fx, x], x] /; FreeQ[a, x] && !Ma tchQ[Fx, (b_)*(Gx_) /; FreeQ[b, x]]
Int[((c_) + (d_.)*tan[(e_.) + (f_.)*(x_)])/((a_) + (b_.)*tan[(e_.) + (f_.)* (x_)]), x_Symbol] :> Simp[(c/(b*f))*Log[RemoveContent[a*Cos[e + f*x] + b*Si n[e + f*x], x]], x] /; FreeQ[{a, b, c, d, e, f}, x] && NeQ[b*c - a*d, 0] && NeQ[a^2 + b^2, 0] && EqQ[a*c + b*d, 0]
Int[((c_.) + (d_.)*tan[(e_.) + (f_.)*(x_)])/((a_.) + (b_.)*tan[(e_.) + (f_. )*(x_)]), x_Symbol] :> Simp[(a*c + b*d)*(x/(a^2 + b^2)), x] + Simp[(b*c - a *d)/(a^2 + b^2) Int[(b - a*Tan[e + f*x])/(a + b*Tan[e + f*x]), x], x] /; FreeQ[{a, b, c, d, e, f}, x] && NeQ[b*c - a*d, 0] && NeQ[a^2 + b^2, 0] && N eQ[a*c + b*d, 0]
Int[((a_.) + (b_.)*tan[(e_.) + (f_.)*(x_)])^(m_)*((c_.) + (d_.)*tan[(e_.) + (f_.)*(x_)])^2, x_Symbol] :> Simp[(b*c - a*d)^2*((a + b*Tan[e + f*x])^(m + 1)/(b*f*(m + 1)*(a^2 + b^2))), x] + Simp[1/(a^2 + b^2) Int[(a + b*Tan[e + f*x])^(m + 1)*Simp[a*c^2 + 2*b*c*d - a*d^2 - (b*c^2 - 2*a*c*d - b*d^2)*Ta n[e + f*x], x], x], x] /; FreeQ[{a, b, c, d, e, f}, x] && NeQ[b*c - a*d, 0] && LtQ[m, -1] && NeQ[a^2 + b^2, 0]
Time = 0.32 (sec) , antiderivative size = 153, normalized size of antiderivative = 1.65
method | result | size |
derivativedivides | \(\frac {a^{2} \left (-\frac {-2 i c d -c^{2}+d^{2}}{\left (c^{2}+d^{2}\right ) d \left (c +d \tan \left (f x +e \right )\right )}-\frac {2 \left (i c^{2}-i d^{2}-2 c d \right ) \ln \left (c +d \tan \left (f x +e \right )\right )}{\left (c^{2}+d^{2}\right )^{2}}+\frac {\frac {\left (2 i c^{2}-2 i d^{2}-4 c d \right ) \ln \left (1+\tan ^{2}\left (f x +e \right )\right )}{2}+\left (4 i c d +2 c^{2}-2 d^{2}\right ) \arctan \left (\tan \left (f x +e \right )\right )}{\left (c^{2}+d^{2}\right )^{2}}\right )}{f}\) | \(153\) |
default | \(\frac {a^{2} \left (-\frac {-2 i c d -c^{2}+d^{2}}{\left (c^{2}+d^{2}\right ) d \left (c +d \tan \left (f x +e \right )\right )}-\frac {2 \left (i c^{2}-i d^{2}-2 c d \right ) \ln \left (c +d \tan \left (f x +e \right )\right )}{\left (c^{2}+d^{2}\right )^{2}}+\frac {\frac {\left (2 i c^{2}-2 i d^{2}-4 c d \right ) \ln \left (1+\tan ^{2}\left (f x +e \right )\right )}{2}+\left (4 i c d +2 c^{2}-2 d^{2}\right ) \arctan \left (\tan \left (f x +e \right )\right )}{\left (c^{2}+d^{2}\right )^{2}}\right )}{f}\) | \(153\) |
norman | \(\frac {\frac {2 a^{2} c x}{\left (-i d +c \right )^{2}}-\frac {2 a^{2} d x \tan \left (f x +e \right )}{\left (i c +d \right )^{2}}-\frac {\left (i a^{2} d +a^{2} c \right ) \tan \left (f x +e \right )}{f \left (-i d +c \right ) c}}{c +d \tan \left (f x +e \right )}+\frac {i a^{2} \ln \left (1+\tan ^{2}\left (f x +e \right )\right )}{f \left (-2 i c d +c^{2}-d^{2}\right )}-\frac {2 i a^{2} \ln \left (c +d \tan \left (f x +e \right )\right )}{f \left (-2 i c d +c^{2}-d^{2}\right )}\) | \(159\) |
risch | \(-\frac {4 a^{2} x}{2 i c d -c^{2}+d^{2}}-\frac {4 i a^{2} x}{i c^{2}-i d^{2}+2 c d}-\frac {4 i a^{2} e}{f \left (i c^{2}-i d^{2}+2 c d \right )}+\frac {2 a^{2} d}{f \left (-i d +c \right )^{2} \left (-i {\mathrm e}^{2 i \left (f x +e \right )} d +{\mathrm e}^{2 i \left (f x +e \right )} c +i d +c \right )}-\frac {2 i a^{2} c}{f \left (-i d +c \right )^{2} \left (-i {\mathrm e}^{2 i \left (f x +e \right )} d +{\mathrm e}^{2 i \left (f x +e \right )} c +i d +c \right )}+\frac {2 a^{2} \ln \left ({\mathrm e}^{2 i \left (f x +e \right )}-\frac {i d +c}{i d -c}\right )}{f \left (i c^{2}-i d^{2}+2 c d \right )}\) | \(234\) |
parallelrisch | \(\frac {-a^{2} d^{4}-2 i \ln \left (c +d \tan \left (f x +e \right )\right ) \tan \left (f x +e \right ) a^{2} c^{2} d^{2}+2 i \ln \left (c +d \tan \left (f x +e \right )\right ) a^{2} c \,d^{3}-2 i \ln \left (c +d \tan \left (f x +e \right )\right ) a^{2} c^{3} d +a^{2} c^{4}-i \ln \left (1+\tan ^{2}\left (f x +e \right )\right ) \tan \left (f x +e \right ) a^{2} d^{4}+i \ln \left (1+\tan ^{2}\left (f x +e \right )\right ) a^{2} c^{3} d +2 i a^{2} c \,d^{3}+i \ln \left (1+\tan ^{2}\left (f x +e \right )\right ) \tan \left (f x +e \right ) a^{2} c^{2} d^{2}+2 i a^{2} c^{3} d -2 x \tan \left (f x +e \right ) a^{2} d^{4} f +2 x \,a^{2} c^{3} d f -2 x \,a^{2} c \,d^{3} f -i \ln \left (1+\tan ^{2}\left (f x +e \right )\right ) a^{2} c \,d^{3}-2 \ln \left (1+\tan ^{2}\left (f x +e \right )\right ) \tan \left (f x +e \right ) a^{2} c \,d^{3}+4 \ln \left (c +d \tan \left (f x +e \right )\right ) \tan \left (f x +e \right ) a^{2} c \,d^{3}-2 \ln \left (1+\tan ^{2}\left (f x +e \right )\right ) a^{2} c^{2} d^{2}+4 \ln \left (c +d \tan \left (f x +e \right )\right ) a^{2} c^{2} d^{2}+2 x \tan \left (f x +e \right ) a^{2} c^{2} d^{2} f +2 i \ln \left (c +d \tan \left (f x +e \right )\right ) \tan \left (f x +e \right ) a^{2} d^{4}+4 i x \tan \left (f x +e \right ) a^{2} c \,d^{3} f +4 i x \,a^{2} c^{2} d^{2} f}{d f \left (c^{2}+d^{2}\right )^{2} \left (c +d \tan \left (f x +e \right )\right )}\) | \(444\) |
1/f*a^2*(-(-2*I*c*d-c^2+d^2)/(c^2+d^2)/d/(c+d*tan(f*x+e))-2*(I*c^2-I*d^2-2 *c*d)/(c^2+d^2)^2*ln(c+d*tan(f*x+e))+1/(c^2+d^2)^2*(1/2*(2*I*c^2-2*I*d^2-4 *c*d)*ln(1+tan(f*x+e)^2)+(4*I*c*d+2*c^2-2*d^2)*arctan(tan(f*x+e))))
Time = 0.24 (sec) , antiderivative size = 140, normalized size of antiderivative = 1.51 \[ \int \frac {(a+i a \tan (e+f x))^2}{(c+d \tan (e+f x))^2} \, dx=-\frac {2 \, {\left (a^{2} c + i \, a^{2} d + {\left (a^{2} c + i \, a^{2} d + {\left (a^{2} c - i \, a^{2} d\right )} e^{\left (2 i \, f x + 2 i \, e\right )}\right )} \log \left (\frac {{\left (i \, c + d\right )} e^{\left (2 i \, f x + 2 i \, e\right )} + i \, c - d}{i \, c + d}\right )\right )}}{{\left (-i \, c^{3} - 3 \, c^{2} d + 3 i \, c d^{2} + d^{3}\right )} f e^{\left (2 i \, f x + 2 i \, e\right )} + {\left (-i \, c^{3} - c^{2} d - i \, c d^{2} - d^{3}\right )} f} \]
-2*(a^2*c + I*a^2*d + (a^2*c + I*a^2*d + (a^2*c - I*a^2*d)*e^(2*I*f*x + 2* I*e))*log(((I*c + d)*e^(2*I*f*x + 2*I*e) + I*c - d)/(I*c + d)))/((-I*c^3 - 3*c^2*d + 3*I*c*d^2 + d^3)*f*e^(2*I*f*x + 2*I*e) + (-I*c^3 - c^2*d - I*c* d^2 - d^3)*f)
Both result and optimal contain complex but leaf count of result is larger than twice the leaf count of optimal. 156 vs. \(2 (73) = 146\).
Time = 1.48 (sec) , antiderivative size = 156, normalized size of antiderivative = 1.68 \[ \int \frac {(a+i a \tan (e+f x))^2}{(c+d \tan (e+f x))^2} \, dx=- \frac {2 i a^{2} \log {\left (\frac {c + i d}{c e^{2 i e} - i d e^{2 i e}} + e^{2 i f x} \right )}}{f \left (c - i d\right )^{2}} + \frac {- 2 i a^{2} c + 2 a^{2} d}{c^{3} f - i c^{2} d f + c d^{2} f - i d^{3} f + \left (c^{3} f e^{2 i e} - 3 i c^{2} d f e^{2 i e} - 3 c d^{2} f e^{2 i e} + i d^{3} f e^{2 i e}\right ) e^{2 i f x}} \]
-2*I*a**2*log((c + I*d)/(c*exp(2*I*e) - I*d*exp(2*I*e)) + exp(2*I*f*x))/(f *(c - I*d)**2) + (-2*I*a**2*c + 2*a**2*d)/(c**3*f - I*c**2*d*f + c*d**2*f - I*d**3*f + (c**3*f*exp(2*I*e) - 3*I*c**2*d*f*exp(2*I*e) - 3*c*d**2*f*exp (2*I*e) + I*d**3*f*exp(2*I*e))*exp(2*I*f*x))
Both result and optimal contain complex but leaf count of result is larger than twice the leaf count of optimal. 214 vs. \(2 (83) = 166\).
Time = 0.31 (sec) , antiderivative size = 214, normalized size of antiderivative = 2.30 \[ \int \frac {(a+i a \tan (e+f x))^2}{(c+d \tan (e+f x))^2} \, dx=\frac {\frac {2 \, {\left (a^{2} c^{2} + 2 i \, a^{2} c d - a^{2} d^{2}\right )} {\left (f x + e\right )}}{c^{4} + 2 \, c^{2} d^{2} + d^{4}} - \frac {2 \, {\left (i \, a^{2} c^{2} - 2 \, a^{2} c d - i \, a^{2} d^{2}\right )} \log \left (d \tan \left (f x + e\right ) + c\right )}{c^{4} + 2 \, c^{2} d^{2} + d^{4}} + \frac {{\left (i \, a^{2} c^{2} - 2 \, a^{2} c d - i \, a^{2} d^{2}\right )} \log \left (\tan \left (f x + e\right )^{2} + 1\right )}{c^{4} + 2 \, c^{2} d^{2} + d^{4}} + \frac {a^{2} c^{2} + 2 i \, a^{2} c d - a^{2} d^{2}}{c^{3} d + c d^{3} + {\left (c^{2} d^{2} + d^{4}\right )} \tan \left (f x + e\right )}}{f} \]
(2*(a^2*c^2 + 2*I*a^2*c*d - a^2*d^2)*(f*x + e)/(c^4 + 2*c^2*d^2 + d^4) - 2 *(I*a^2*c^2 - 2*a^2*c*d - I*a^2*d^2)*log(d*tan(f*x + e) + c)/(c^4 + 2*c^2* d^2 + d^4) + (I*a^2*c^2 - 2*a^2*c*d - I*a^2*d^2)*log(tan(f*x + e)^2 + 1)/( c^4 + 2*c^2*d^2 + d^4) + (a^2*c^2 + 2*I*a^2*c*d - a^2*d^2)/(c^3*d + c*d^3 + (c^2*d^2 + d^4)*tan(f*x + e)))/f
Both result and optimal contain complex but leaf count of result is larger than twice the leaf count of optimal. 221 vs. \(2 (83) = 166\).
Time = 0.52 (sec) , antiderivative size = 221, normalized size of antiderivative = 2.38 \[ \int \frac {(a+i a \tan (e+f x))^2}{(c+d \tan (e+f x))^2} \, dx=\frac {2 \, {\left (\frac {a^{2} \log \left (c \tan \left (\frac {1}{2} \, f x + \frac {1}{2} \, e\right )^{2} - 2 \, d \tan \left (\frac {1}{2} \, f x + \frac {1}{2} \, e\right ) - c\right )}{i \, c^{2} + 2 \, c d - i \, d^{2}} + \frac {2 \, a^{2} \log \left (\tan \left (\frac {1}{2} \, f x + \frac {1}{2} \, e\right ) + i\right )}{-i \, c^{2} - 2 \, c d + i \, d^{2}} - \frac {a^{2} c^{2} \tan \left (\frac {1}{2} \, f x + \frac {1}{2} \, e\right )^{2} - i \, a^{2} c^{2} \tan \left (\frac {1}{2} \, f x + \frac {1}{2} \, e\right ) - 2 \, a^{2} c d \tan \left (\frac {1}{2} \, f x + \frac {1}{2} \, e\right ) - i \, a^{2} d^{2} \tan \left (\frac {1}{2} \, f x + \frac {1}{2} \, e\right ) - a^{2} c^{2}}{{\left (i \, c^{3} + 2 \, c^{2} d - i \, c d^{2}\right )} {\left (c \tan \left (\frac {1}{2} \, f x + \frac {1}{2} \, e\right )^{2} - 2 \, d \tan \left (\frac {1}{2} \, f x + \frac {1}{2} \, e\right ) - c\right )}}\right )}}{f} \]
2*(a^2*log(c*tan(1/2*f*x + 1/2*e)^2 - 2*d*tan(1/2*f*x + 1/2*e) - c)/(I*c^2 + 2*c*d - I*d^2) + 2*a^2*log(tan(1/2*f*x + 1/2*e) + I)/(-I*c^2 - 2*c*d + I*d^2) - (a^2*c^2*tan(1/2*f*x + 1/2*e)^2 - I*a^2*c^2*tan(1/2*f*x + 1/2*e) - 2*a^2*c*d*tan(1/2*f*x + 1/2*e) - I*a^2*d^2*tan(1/2*f*x + 1/2*e) - a^2*c^ 2)/((I*c^3 + 2*c^2*d - I*c*d^2)*(c*tan(1/2*f*x + 1/2*e)^2 - 2*d*tan(1/2*f* x + 1/2*e) - c)))/f
Time = 5.95 (sec) , antiderivative size = 139, normalized size of antiderivative = 1.49 \[ \int \frac {(a+i a \tan (e+f x))^2}{(c+d \tan (e+f x))^2} \, dx=-\frac {a^2\,\mathrm {atanh}\left (\frac {c^2+d^2}{{\left (d+c\,1{}\mathrm {i}\right )}^2}+\frac {\mathrm {tan}\left (e+f\,x\right )\,\left (2\,c^4\,d^2+4\,c^2\,d^4+2\,d^6\right )}{{\left (d+c\,1{}\mathrm {i}\right )}^2\,\left (c^3\,d+c^2\,d^2\,1{}\mathrm {i}+c\,d^3+d^4\,1{}\mathrm {i}\right )}\right )\,4{}\mathrm {i}}{f\,{\left (d+c\,1{}\mathrm {i}\right )}^2}+\frac {a^2\,\left (c+d\,1{}\mathrm {i}\right )}{d^2\,f\,\left (\mathrm {tan}\left (e+f\,x\right )+\frac {c}{d}\right )\,\left (c-d\,1{}\mathrm {i}\right )} \]